const AdminDetailModel = require('../../models/administration/detail/detail')
const { adminDetailData } = require('../../db/admindetail/admindetail')

class AdminDetailController {
  async getAdminDetail(ctx) {
    const adminlistDataModel = new AdminDetailModel()

    try {
      adminlistDataModel.collection.insertMany(adminDetailData, (err) => {
        if (err) {
          console.log(err)
        } else {
          console.log('Multiple docs inserted')
        }
      })
      

      const iid = ctx.request.body.iid
      

      console.log(iid, '666666')
     

     

      const findAdminDetailData = await AdminDetailModel.findOne({
        iid,
      })
      console.log(findAdminDetailData, '00000')




      ctx.status = 200
      ctx.body = {
        success: true,
        data: {
          findAdminDetailData,
        },
  
      }
    } catch (err) {
      ctx.status = 500
      ctx.body = { error: 'Failed to save data', details: err.message }
    }
  }
}

module.exports = new AdminDetailController()
